package com.example.utils;

import lombok.Data;

import java.io.Serializable;

/**
 * @author guoQ.z
 * @date 2021/1/12 14:05
 * TODO
 */
@Data
public class ResultWrapper implements Serializable {

    private static final String SUCCESS_CODE = "200";
    private static final String SUCCESS_MSG = "200";

    private static final String FAILURE_CODE = "500";
    private static final String FAILURE_MSG = "500";

    private String respCode;
    private String respMessage;
    private Object respData;

    public ResultWrapper() {

    }

    public ResultWrapper(String respCode, String respMessage, Object respData) {
        this.respCode = respCode;
        this.respMessage = respMessage;
        this.respData = respData;
    }

    public static ResultWrapper failure() {
        return new ResultWrapper(FAILURE_CODE, FAILURE_MSG, null);
    }

    public static ResultWrapper failure(String message) {
        return new ResultWrapper(FAILURE_CODE, message, null);
    }
}
